package com.leetCode;

/**
 * Description:
 * Copyright:   Copyright (c)2019
 * Company:     zefu
 *
 * @author: 张李鑫
 * @version: 1.0
 * Create at:   2021-10-27 14:02:15
 * <p>
 * Modification History:
 * Date         Author      Version     Description
 * ------------------------------------------------------------------
 * 2021-10-27     张李鑫                     1.0         1.0 Version
 */
public class FirstBadVersion {

    public static void main(String[] args) {
        System.out.println(2>>1);
    }

    public int firstBadVersion(int n) {
        int start=n;
        int end=n;
        int mid=n>>1;
        while (mid>>1!=mid){
            if (isBadVersion(mid)){
                mid=(end-mid)>>1+mid;
                start=mid;
            }else {
                mid=(mid-start)>>1+start;
                end=mid;
            }
        }

        return mid;
    }




    public static boolean isBadVersion(int index){
        return true;
    }
}
